//
//  ShareViewController.m
//  cityStar
//
//  Created by apple on 14/12/13.
//  Copyright (c) 2014年 tiny. All rights reserved.
//

#import "ShareViewController.h"
#import "HTDefine.h"
#import "SideViewController.h"
@interface ShareViewController ()
@property (weak, nonatomic) IBOutlet UIView *vLine;
@property (weak, nonatomic) IBOutlet UIView *vLine2;
@property (weak, nonatomic) IBOutlet UIView *vLine3;
@property (weak, nonatomic) IBOutlet UIButton *btnCancel;

@end

@implementation ShareViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initNavBar];
    self.view.backgroundColor = kBackgroundColor;
    self.vLine.backgroundColor = kLineColor1;
    self.vLine2.backgroundColor = kLineColor2;
    self.vLine3.backgroundColor = kLineColor3;
    self.btnCancel.backgroundColor =  rgba(255,196,110,1);
    self.btnCancel.clipsToBounds = YES;
    self.btnCancel.layer.cornerRadius = 5;
    
    // Do any additional setup after loading the view.
}
- (void)initNavBar{
    self.navigationItem.title = @"分享";
    UISwipeGestureRecognizer* recognizer;
    recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
    recognizer.direction = UISwipeGestureRecognizerDirectionRight;
    [self.view addGestureRecognizer:recognizer];

    UIButton *btnSide = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 20, 20)];
    [btnSide setImage:[UIImage imageNamed:@"more"] forState:UIControlStateNormal];
    [btnSide setImage:[UIImage imageNamed:@"more_touch"] forState:UIControlStateHighlighted];
    [btnSide addTarget:self action:@selector(sideMove) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *bbtmLeft = [[UIBarButtonItem alloc]initWithCustomView:btnSide];
    self.navigationItem.leftBarButtonItem = bbtmLeft;
}
-(void)viewWillAppear:(BOOL)animated
{
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >=7.0) {
        self.navigationController.navigationBar.translucent = NO; //禁止半透明毛玻璃效果
        self.navigationController.navigationBar.tintColor = kWhiteNavTitleColor; //返回按钮颜色
        self.navigationController.navigationBar.barTintColor = [UIColor whiteColor]; //bar背景颜色
        self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:kWhiteNavTitleColor,NSFontAttributeName:[UIFont boldSystemFontOfSize:18]}; //标题颜色
        self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
    }else{
        [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]]; //bar背景颜色
        self.navigationController.navigationBar.translucent = NO;
        self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:kWhiteNavTitleColor,NSFontAttributeName:[UIFont boldSystemFontOfSize:18]};
        self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
    }
}
- (void)handleSwipeFrom:(UISwipeGestureRecognizer*)recognizer {
    [self sideMove];
    //    [self.view removeGestureRecognizer:recognizer];
}

- (void)sideMove{
    [[SideViewController shareVc] showLeftView];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
